{include file="public/header" /}
</head>
<body>
    <div id="main-container">
        {include file="public/menu" /}
        <div class="main">
            <div class="notice">{$position.url}</div>
            <div class="main_content">
                <div class="title">
                    <span>{$position.name}</span>
                </div>
				<form  class="layui-form layui-form-pane" id="formrec" method="post" role="form">
				<div class="ui_prompt">
					<p class="ui_prompt_tit">温馨提示</p>
					<p>· 启用伪静态有益于网站优化 </p>
				</div>

				<div class="layui-form-item">
                    <label class="layui-form-label">URL模式</label>
                    <div class="layui-input-inline">
                        <input type="radio" name="url_model" {if config('sys.url_model') eq 1}checked{/if} value="1" lay-filter="urlmodel" title="动态" checked>
                        <input type="radio" name="url_model" {if config('sys.url_model') eq 3}checked{/if} value="3" lay-filter="urlmodel" title="伪静态">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label"></label>
                    <div class="layui-input-inline">
                        <button class="btn" lay-submit="" lay-filter="save" data-href='{:url('index')}'>提交</button>
                    </div>
                </div>
    
				<ul class="list box" {if config('sys.url_model') neq 2}style="display:none;"{/if}>
					<li><a class="btn" href="javascript:;">生成所有页面</a></li>
					<li><a class="btn" href="javascript:;">生成首页</a></li>
					<li><a class="btn" href="javascript:;">生成栏目页</a></li>
					<li><a class="btn" href="javascript:;">生成内容页</a></li>
				</ul>

				</form>
			</div>
			
		</div>
	</div>
<script>
layui.use(['form','common'], function(){
    var $ = layui.jquery;
    $form = $('form');
    var form = layui.form(),layer = layui.layer, common=layui.common;

    //监听提交
    form.on('submit(save)', function(data){
        var sub = true;
        var url = $(this).data('href');
        if(url){
            if(sub){
                $.ajax({
                    url: url,
                    type: 'post',
                    dataType: 'json',
                    data: data.field,
                    success: function (info) {
                        if (info.code == 1) {
                            common.layerAlertSHref(info.msg, '提示', "{:url('url/index')}");
                        }else {
                            common.layerAlertE(info.msg, '提示');
                            $(data.elem).removeAttr("disabled").text("提交");
                        }
                    }
                });
            }
        }
        return false;
    });

    form.on('radio(urlmodel)', function(data){
	  	if (data.value == 2) {
	  		$('.list.box').show();
	  	}else{
	  		$('.list.box').hide();
	  	}
	});
});
</script>
</body>
</html>